﻿@using BE.ModelosIII.Domain
@using BE.ModelosIII.Infrastructure.Helpers
@using BE.ModelosIII.Mvc.Models.Run
@using MvcContrib.FluentHtml
@inherits ModelWebViewPage<RunViewModel>


<fieldset>
    <section class="utopia-widget">
        <div class="utopia-widget-title">
            <span>General</span>
        </div>
        <div class="utopia-widget-content">
            <div class="form-horizontal">
                <div class="control-group">
                    <label class="control-label">
                        Escenario</label>
                    <label class="control-label span4">@Model.ScenarioName</label>
                </div>
                <div class="control-group">
                    <label class="control-label">
                        Tamaño de Caja</label>
                    <label class="control-label span4">@Model.BinSize</label>
                </div>
                <div class="control-group">
                    <label class="control-label">
                        Fecha</label>
                    <label class="control-label span4 utcToLocaleDate" data-utc="@Model.RunOn.ToString("o")"></label>
                </div>
            </div>
        </div>
    </section>
    <section class="utopia-widget">
        <div class="utopia-widget-title">
            <span>Items</span>
        </div>
        <div class="utopia-widget-content">
            <div class="form-horizontal">

                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th>Etiqueta</th>
                            <th>Cantidad</th>
                            <th>Tamaño</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model.Items)
                        {
                            <tr>
                                <td>@item.Label</td>
                                <td>@item.Quantity</td>
                                <td>@item.Size</td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
        </div>
    </section>
    <section class="utopia-widget">
        <div class="utopia-widget-title">
            <span>Solución Encontrada</span>
        </div>
        <div class="utopia-widget-content">
            <div class="form-horizontal">
                <div class="control-group">
                    <label class="control-label">
                        Fitness</label>
                    <label class="control-label span4">@Model.Population.Fitness.ToString("N3")</label>
                </div>
                <div class="control-group">
                    <label class="control-label">
                        Cantidad de Cajas</label>
                    <label class="control-label span4">@Model.Population.BinCount</label>
                </div>
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th>Caja #</th>
                            <th>Tamaño Usado</th>
                            <th>Porcentaje Usado</th>
                            <th>Items</th>
                        </tr>
                    </thead>
                    <tbody>
                        @{int index = 0;}
                        @foreach (var bin in Model.Population.Bins)
                        {
                            <tr>
                                <td>@(++index)</td>
                                <td>@bin.Filled.ToString("N2")</td>
                                <td>@((bin.Filled / bin.Capacity).ToString("P"))</td>
                                <td>
                                    @foreach (var binItem in bin.Items)
                                    {
                                        @binItem
                                        <br />
                                    }

                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
        </div>
    </section>
    <section class="utopia-widget">
        <div class="utopia-widget-title">
            <span>Configuración Avanzada</span>
        </div>
        <div class="utopia-widget-content">
            <div class="form-horizontal">
                <div class="control-group">
                    <label class="control-label">
                        Probabilidad de Cruza
                    </label>
                    <label class="control-label span4">@Model.CrossoverProbability.ToString("P0")</label>
                </div>
                <div class="control-group">
                    <label class="control-label">
                        Probabilidad de Mutación
                    </label>
                    <label class="control-label span4">@Model.MutationProbability.ToString("P0")</label>
                </div>
                <div class="control-group">
                    <label class="control-label">
                        Tamaño de la Población
                    </label>
                    <label class="control-label span4">@Model.PopulationSize</label>
                </div>
                <div class="control-group">
                    <label class="control-label">
                        Criterio de Parada
                    </label>
                    <label class="control-label span4">@Model.StopCriterion.ToDescription()</label>
                </div>
                <div class="control-group">
                    <label class="control-label">
                        Profundidad de Parada
                    </label>
                    <label class="control-label span4">@Model.StopDepth</label>
                </div>
            </div>
        </div>
    </section>
    <br />
    <div class="control-group box-last">
        <div class="utopia-form-button">
            <a href="@Url.Action("Index")" class="btn span3">Volver</a>
        </div>
    </div>
</fieldset>
